<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./03-promise.js"></script>
</head>

<body>
    <script>

        let p = new Promise((resolve, reject) => {
            console.log(111);
            setTimeout(() => {
                resolve('ok');
            }, 1000)
        })

        // let result = p.then(value => {
        //     console.log(222);
        // }).then(value=>{
        //     console.log(33);
        // }).catch(reason=>{
        //     console.log(reason);
        //     return new Promise((resolve,reject)=>{
        //         reject('hhahah');
        //     })
        // })
        // console.log(result);
        
        let p1 = Promise.resolve(111);
        let p2 = Promise.resolve(222);

        let p3 = Promise.all([p,p1,p2]);
        console.log(p3);

        p3.then(value=>{
            console.log(value);
        })

    </script>
</body>

</html>